package com.gitee.passerr.leetcode.problem.lcci.page2

import spock.lang.Specification
import spock.lang.Unroll

/**
 * {@link Lcci1614}单元测试
 * @date 2020/08/27 09:53
 * @Copyright (c) wisewe co.,ltd
 * @author xiehai
 */
class Lcci1614Spec extends Specification {
    Lcci1614 lcci1614 = new Lcci1614()

    @Unroll
    def "bestLine(#points) = #result"() {
        expect:
        result == this.lcci1614.bestLine(points)

        where:
        points       || result
        [
            [-38935, 27124], [-39837, 19604], [-7086, 42194], [-11571, -23257], [115, -23257], [20229, 5976],
            [24653, -18488], [11017, 21043], [-9353, 16550], [-47076, 15237], [-36686, 42194], [-17704, 1104],
            [31067, 7368], [-20882, 42194], [-19107, -10597], [-14898, 24506], [-20801, 42194], [-52268, 40727],
            [-14042, 42194], [-23254, 42194], [-30837, -53882], [1402, 801], [-33961, -984], [-6411, 42194],
            [-12210, 22901], [-8213, -19441], [-26939, 20810], [30656, -23257], [-27195, 21649], [-33780, 2717],
            [23617, 27018], [12266, 3608]
        ] as int[][] || [2, 10] as int[]
        [
            [-2160, 34152], [-2942, 1637], [-8995, -31970], [-15048, -33786], [-18996, -41685], [-24537, -19974],
            [-40199, 14156], [-16766, -24497], [3111, -28338], [-16766, -25972], [15217, -24706], [-2942, -30154],
            [21270, -22890], [-15361, -15384]
        ] as int[][] || [2, 3] as int[]
    }
}